package com.dbsun.controller.st;

import com.dbsun.base.BaseController;
import com.dbsun.common.ServerResponse;
import com.dbsun.entity.system.Page;
import com.dbsun.entity.system.PageData;
import io.swagger.annotations.Api;
import com.dbsun.service.st.Small_studentService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Api(value = "small_student", description = "学生管理", tags = "学生管理")
@Controller
@RequestMapping("/small_student")
public class Small_studentController extends BaseController {
    @Autowired
    private Small_studentService sSmall_studentService;

    @RequestMapping(value = "/gosSmall_studentPage", method = RequestMethod.GET)
    @ApiOperation(value = "跳转到学生管理页面")
    public String gosSmall_studentPage() {
        return "";
    }

    @RequestMapping(value = "/getPagesSmall_studentList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取学生管理列表数据", notes = "分页")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "showCount", value = "每页记录数", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "currentPage", value = "当前页", required = true, dataType = "String"),
    })
    public JSONObject getPagesSmall_studentList() {
        PageData pd = this.getPageData();
        Page page = this.getPage();
        page.setPd(pd);
        List<PageData> sSmall_studentList = null;
        try {
            sSmall_studentList = sSmall_studentService.getPageSmall_studentList(page);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return viewReturnPageData(page, sSmall_studentList);
    }

    @RequestMapping(value = "/getAllSmall_studentList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取全部学生管理列表数据", notes = "分页")
    @ApiImplicitParams({})
    public JSONObject getAllSmall_studentList() {
        Page page = this.getPage();
        page.setShowCount(10000);
        List<PageData> sSmall_studentList = null;
        try {
            sSmall_studentList = sSmall_studentService.getPageSmall_studentList(page);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return viewReturnPageData(page, sSmall_studentList);
    }

    @RequestMapping(value = "/addsSmall_student", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "添加学生管理", notes = "添加不为空的内容")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "a_id", value = "学生管理", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "name", value = "名字", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "student_id", value = "学号", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "grade", value = "年级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_class", value = "班级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "create_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "update_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_de", value = "德", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_zhi", value = "智", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_ti", value = "体", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_mei", value = "美", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_nao", value = "劳", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_content", value = "评论内容", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_id", value = "老师id", required = false, dataType = "String"),
    })
    public ServerResponse addsSmall_student() {
        PageData pd = this.getPageData();
        PageData userPd = this.getUserPd();
        return sSmall_studentService.addSmall_student(this.putUserPd(pd));
    }

    @RequestMapping(value = "/updatesSmall_student", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "更新学生管理", notes = "更新不为空的内容")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", value = "xxx", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "a_id", value = "学生管理", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "name", value = "名字", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "student_id", value = "学号", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "grade", value = "年级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_class", value = "班级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "create_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "update_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_de", value = "德", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_zhi", value = "智", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_ti", value = "体", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_mei", value = "美", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_nao", value = "劳", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_content", value = "评论内容", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_id", value = "老师id", required = false, dataType = "String")
    })
    public ServerResponse updatesSmall_studentByid() {
        PageData pd = this.getPageData();
        PageData userPd = this.getUserPd();
        return sSmall_studentService.updateSmall_studentByid(pd);
    }

    @RequestMapping(value = "/getsSmall_studentList", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取学生管理列表数据非分页方法")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", value = "xxx", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "a_id", value = "学生管理", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "name", value = "名字", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "student_id", value = "学号", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "grade", value = "年级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_class", value = "班级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "create_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "update_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_de", value = "德", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_zhi", value = "智", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_ti", value = "体", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_mei", value = "美", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_nao", value = "劳", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_content", value = "评论内容", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_id", value = "老师id", required = false, dataType = "String")
    })
    public ServerResponse getsSmall_studentList() {
        PageData pd = this.getPageData();
        PageData userPd = this.getUserPd();
        return sSmall_studentService.getSmall_studentList(pd);
    }

    @RequestMapping(value = "/getsSmall_studentByColumn", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "获取学生管理单条数据(通过任意列)")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", value = "xxx", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "a_id", value = "学生管理", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "name", value = "名字", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "student_id", value = "学号", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "grade", value = "年级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_class", value = "班级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "create_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "update_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_de", value = "德", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_zhi", value = "智", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_ti", value = "体", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_mei", value = "美", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_nao", value = "劳", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_content", value = "评论内容", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_id", value = "老师id", required = false, dataType = "String")
    })
    public ServerResponse getsSmall_studentByColumn() {
        PageData pd = this.getPageData();
        PageData userPd = this.getUserPd();
        return sSmall_studentService.getSmall_studentByColumn(pd);
    }

    @RequestMapping(value = "/deletesSmall_student", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation(value = "删除学生管理", notes = "删除不为空的内容")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "id", value = "xxx", required = true, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "a_id", value = "学生管理", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "name", value = "名字", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "student_id", value = "学号", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "grade", value = "年级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_class", value = "班级", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "create_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "update_time", value = "时间", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_de", value = "德", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_zhi", value = "智", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_ti", value = "体", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_mei", value = "美", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_nao", value = "劳", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_content", value = "评论内容", required = false, dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "s_id", value = "老师id", required = false, dataType = "String")
    })
    public ServerResponse deletesSmall_studentByColumn() {
        PageData pd = this.getPageData();
        return sSmall_studentService.deleteSmall_studentByColumn(pd);
    }
}
